<?php
/**
 * Created by PhpStorm.
 * User: wliu
 * Date: 14-4-7
 * Time: 下午10:14
 */

class DubaiService {
    /**
     * 生成订单时，启动订单监控任务
     * @param $oid
     * @param int $time
     * @return mixed
     */
    public static function addOrderMonitorTask($oid,$time=_LOCK_EXPIRE_TIME) {
        $url='http://'._TASK_SERVER_IP.':'._TASK_SERVER_PORT.'/dubai/OrderMonitor?type=1&oid='.$oid.'&time='.$time*1000;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        $result = curl_exec($ch);
        return $result;
    }

    /**
     * 取消订单或完成订单时，取消订单监控任务
     * @param $oid
     * @return mixed
     */
    public static  function cancelOrderMonitorTask($oid) {
        $url='http://'._TASK_SERVER_IP.':'._TASK_SERVER_PORT.'/dubai/OrderMonitor?type=0&oid='.$oid;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        $result = curl_exec($ch);
        return $result;
    }
} 